package jframe.validator;

import com.jfinal.core.Controller;
import com.jfinal.validate.Validator;

/**
 * User: Ulric Qin
 * Mail: ulric.qin@gmail.com
 */
public class BlogrollSaveValidator extends Validator {
    @Override
    protected void validate(Controller controller) {
        validateRequiredString("url", "msg", "网站链接不能为空");
        validateRequiredString("title", "msg", "网站标题不能为空");
        validateUrl("url", "msg", "网站链接应该是个合法的URL地址");
    }

    @Override
    protected void handleError(Controller controller) {
        controller.renderJson();
    }
}
